//
//  UIView+YJCSetting.m
//  MyDemos
//
//  Created by IOS3 on 2019/3/8.
//  Copyright © 2019 iMac. All rights reserved.
//

#import "UIView+YJCSetting.h"



@implementation UIView (YJCSetting)



/// setFrame
- (UIView *(^)(CGRect frame))setFrame {
    __weak typeof(self)weakSelf = self;
    return ^(CGRect frame) {
        __strong typeof(weakSelf)strongSelf = weakSelf;
        strongSelf.frame = frame;
        return strongSelf;
    };
}

/// set background color
- (UIView *(^)(UIColor *color))setBGColor {
    __weak typeof(self)weakSelf = self;
    return ^(UIColor *color) {
        __strong typeof(weakSelf)strongSelf = weakSelf;
        strongSelf.backgroundColor = color;
        return strongSelf;
    };
}

/// add subview
- (UIView *(^)(UIView *view))addSubView {
    __weak typeof(self)weakSelf = self;
    return ^(UIView *view) {
        __strong typeof(weakSelf)strongSelf = weakSelf;
        [strongSelf addSubview:view];
        return strongSelf;
    };
}

/// set tag
- (UIView *(^)(NSInteger tag))setTag {
    __weak typeof(self)weakSelf = self;
    return ^(NSInteger tag) {
        __strong typeof(weakSelf)strongSelf = weakSelf;
        strongSelf.tag = tag;
        return strongSelf;
    };
}


@end
